% This file generates Figure 7 in the paper. It plots the results obtained
% from running 'FIGs_3_4_Table_3_Baseline_Output.m' for all the alternative
% measures of output considered in the paper. In order to create the figure
% that file needs to be run for all the different output measures. This
% file automatically imports information saved in the .xlsx file and
% creates the figure. 

clear; close all; clc;
                    
%% Importing the proper data. 

Y_IRF_OUT_ZLB_LP_IP         = (xlsread('Output.xlsx','IP','B2:B14'));
Y_IRF_OUT_ZLB_LP_LB_IP      = (xlsread('Output.xlsx','IP','C2:C14'));
Y_IRF_OUT_ZLB_LP_UB_IP      = (xlsread('Output.xlsx','IP','D2:D14'));    
Y_IRF_IN_ZLB_LP_IP          = (xlsread('Output.xlsx','IP ZLB','B2:B14'));
Y_IRF_IN_ZLB_LP_LB_IP       = (xlsread('Output.xlsx','IP ZLB','C2:C14'));
Y_IRF_IN_ZLB_LP_UB_IP       = (xlsread('Output.xlsx','IP ZLB','D2:D14'));
Y_IRF_OUT_ZLB_SLP_IP        = (xlsread('Output.xlsx','IP','E2:E14'));
Y_IRF_OUT_ZLB_SLP_LB_IP     = (xlsread('Output.xlsx','IP','F2:F14'));
Y_IRF_OUT_ZLB_SLP_UB_IP     = (xlsread('Output.xlsx','IP','G2:G14'));
Y_IRF_IN_ZLB_SLP_IP         = (xlsread('Output.xlsx','IP ZLB','E2:E14'));
Y_IRF_IN_ZLB_SLP_LB_IP      = (xlsread('Output.xlsx','IP ZLB','F2:F14'));
Y_IRF_IN_ZLB_SLP_UB_IP      = (xlsread('Output.xlsx','IP ZLB','G2:G14'));
    
Y_IRF_OUT_ZLB_LP_HRS        = (xlsread('Output.xlsx','HOURS','B2:B14'));
Y_IRF_OUT_ZLB_LP_LB_HRS     = (xlsread('Output.xlsx','HOURS','C2:C14'));
Y_IRF_OUT_ZLB_LP_UB_HRS     = (xlsread('Output.xlsx','HOURS','D2:D14'));
Y_IRF_IN_ZLB_LP_HRS         = (xlsread('Output.xlsx','HOURS ZLB','B2:B14'));
Y_IRF_IN_ZLB_LP_LB_HRS      = (xlsread('Output.xlsx','HOURS ZLB','C2:C14'));
Y_IRF_IN_ZLB_LP_UB_HRS      = (xlsread('Output.xlsx','HOURS ZLB','D2:D14'));
Y_IRF_OUT_ZLB_SLP_HRS       = (xlsread('Output.xlsx','HOURS','E2:E14'));
Y_IRF_OUT_ZLB_SLP_LB_HRS    = (xlsread('Output.xlsx','HOURS','F2:F14'));
Y_IRF_OUT_ZLB_SLP_UB_HRS    = (xlsread('Output.xlsx','HOURS','G2:G14'));
Y_IRF_IN_ZLB_SLP_HRS        = (xlsread('Output.xlsx','HOURS ZLB','E2:E14'));
Y_IRF_IN_ZLB_SLP_LB_HRS     = (xlsread('Output.xlsx','HOURS ZLB','F2:F14'));
Y_IRF_IN_ZLB_SLP_UB_HRS     = (xlsread('Output.xlsx','HOURS ZLB','G2:G14'));   
    
Y_IRF_OUT_ZLB_LP_UNMPL      = (xlsread('Output.xlsx','UNEMPLOYMENT','B2:B14'));
Y_IRF_OUT_ZLB_LP_LB_UNMPL   = (xlsread('Output.xlsx','UNEMPLOYMENT','C2:C14'));
Y_IRF_OUT_ZLB_LP_UB_UNMPL   = (xlsread('Output.xlsx','UNEMPLOYMENT','D2:D14'));
Y_IRF_IN_ZLB_LP_UNMPL       = (xlsread('Output.xlsx','UNEMPLOYMENT ZLB','B2:B14'));
Y_IRF_IN_ZLB_LP_LB_UNMPL    = (xlsread('Output.xlsx','UNEMPLOYMENT ZLB','C2:C14'));
Y_IRF_IN_ZLB_LP_UB_UNMPL    = (xlsread('Output.xlsx','UNEMPLOYMENT ZLB','D2:D14'));
Y_IRF_OUT_ZLB_SLP_UNMPL     = (xlsread('Output.xlsx','UNEMPLOYMENT','E2:E14'));
Y_IRF_OUT_ZLB_SLP_LB_UNMPL  = (xlsread('Output.xlsx','UNEMPLOYMENT','F2:F14'));
Y_IRF_OUT_ZLB_SLP_UB_UNMPL  = (xlsread('Output.xlsx','UNEMPLOYMENT','G2:G14'));
Y_IRF_IN_ZLB_SLP_UNMPL      = (xlsread('Output.xlsx','UNEMPLOYMENT ZLB','E2:E14'));
Y_IRF_IN_ZLB_SLP_LB_UNMPL   = (xlsread('Output.xlsx','UNEMPLOYMENT ZLB','F2:F14'));
Y_IRF_IN_ZLB_SLP_UB_UNMPL   = (xlsread('Output.xlsx','UNEMPLOYMENT ZLB','G2:G14'));  

%% Creating the Figure (this file generates both the SLP and the LP IRFs.)

t       =   0:8;      
figure
subplot(1,3,1)
shadedplot(t,Y_IRF_OUT_ZLB_LP_LB_IP',Y_IRF_OUT_ZLB_LP_UB_IP',[0.75,0.75,0.75],'w');
hold on
U       =   plot(t,Y_IRF_OUT_ZLB_LP_IP,'x-b',t,Y_IRF_IN_ZLB_LP_IP,'-r',...
            t,Y_IRF_IN_ZLB_LP_LB_IP,'*--r',t,Y_IRF_IN_ZLB_LP_UB_IP,'*--r','Linewidth',1.5);
hold on 
grid on
title('Industrial Production','Interpreter','latex','fontSize',14);
xlabel('Horizon','Interpreter','latex','fontSize',12);
ylabel('Percent','Interpreter','latex','fontSize',12);
subplot(1,3,2)
shadedplot(t,Y_IRF_OUT_ZLB_LP_LB_HRS',Y_IRF_OUT_ZLB_LP_UB_HRS',[0.75,0.75,0.75],'w');
hold on
U       = plot(t,Y_IRF_OUT_ZLB_LP_HRS,'x-b',t,Y_IRF_IN_ZLB_LP_HRS,'-r',...
        t,Y_IRF_IN_ZLB_LP_LB_HRS,'*--r',t,Y_IRF_IN_ZLB_LP_UB_HRS,'*--r','Linewidth',1.5);
h       = legend(U, 'No ZLB','ZLB','Location','NorthWest');
set(h,'Interpreter','latex');
hold on
grid on
title('Hours Per Capita','Interpreter','latex','fontSize',14);
xlabel('Horizon','Interpreter','latex','fontSize',12);
ylabel('Percent','Interpreter','latex','fontSize',12);
subplot(1,3,3)
shadedplot(t,Y_IRF_OUT_ZLB_LP_LB_UNMPL',Y_IRF_OUT_ZLB_LP_UB_UNMPL',[0.75,0.75,0.75],'w');
hold on
U       = plot(t,Y_IRF_OUT_ZLB_LP_UNMPL,'x-b',t,Y_IRF_IN_ZLB_LP_UNMPL,'-r',...
               t,Y_IRF_IN_ZLB_LP_LB_UNMPL,'*--r',t,Y_IRF_IN_ZLB_LP_UB_UNMPL,'*--r','Linewidth',1.5);
grid on
title('Unemployment','Interpreter','latex','fontSize',14);
xlabel('Horizon','Interpreter','latex','fontSize',12);
ylabel('Percent','Interpreter','latex','fontSize',12);
A       =   suptitle('Output to Productivity LP');
set(A,'Interpreter','latex','fontSize',18);

figure
subplot(1,3,1)
shadedplot(t,Y_IRF_OUT_ZLB_SLP_LB_IP',Y_IRF_OUT_ZLB_SLP_UB_IP',[0.75,0.75,0.75],'w');
hold on
plot(t,Y_IRF_OUT_ZLB_SLP_IP,'x-b',t,Y_IRF_IN_ZLB_SLP_IP,'-r',...
     t,Y_IRF_IN_ZLB_SLP_LB_IP,'*--r',t,Y_IRF_IN_ZLB_SLP_UB_IP,'*--r','Linewidth',1.5);
grid on
title('Industrial Production','Interpreter','latex','fontSize',14);
xlabel('Horizon','Interpreter','latex','fontSize',12);
ylabel('Percent','Interpreter','latex','fontSize',12);
subplot(1,3,2)
shadedplot(t,Y_IRF_OUT_ZLB_SLP_LB_HRS',Y_IRF_OUT_ZLB_SLP_UB_HRS',[0.75,0.75,0.75],'w');
hold on
U = plot(t,Y_IRF_OUT_ZLB_SLP_HRS,'x-b',t,Y_IRF_IN_ZLB_SLP_HRS,'-r',...
     t,Y_IRF_IN_ZLB_SLP_LB_HRS,'*--r',t,Y_IRF_IN_ZLB_SLP_UB_HRS,'*--r','Linewidth',1.5);
h       = legend(U, 'No ZLB','ZLB','Location','NorthWest');
set(h,'Interpreter','latex');
hold on
grid on
title('Hours Per Capita','Interpreter','latex','fontSize',14);
xlabel('Horizon','Interpreter','latex','fontSize',12);
ylabel('Percent','Interpreter','latex','fontSize',12);
subplot(1,3,3)
shadedplot(t,Y_IRF_OUT_ZLB_SLP_LB_UNMPL',Y_IRF_OUT_ZLB_SLP_UB_UNMPL',[0.75,0.75,0.75],'w');
hold on
U       =   plot(t,Y_IRF_OUT_ZLB_SLP_UNMPL,'x-b',t,Y_IRF_IN_ZLB_SLP_UNMPL,'-r',...
            t,Y_IRF_IN_ZLB_SLP_LB_UNMPL,'*--r',t,Y_IRF_IN_ZLB_SLP_UB_UNMPL,'*--r','Linewidth',1.5);
grid on
title('Unemployment','Interpreter','latex','fontSize',14);
xlabel('Horizon','Interpreter','latex','fontSize',12);
ylabel('Percent','Interpreter','latex','fontSize',12);

A       =   suptitle('Output to Productivity SLP');
set(A,'Interpreter','latex','fontSize',18);
